home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Hyper / S / ShortStack.sit / ShortStack / card_2671.txt < prev    next >
Encoding:
Text File  |  1994-10-07  |  4.9 KB  |  199 lines

  1. -- card: 2671 from stack: in
  2. -- bmap block id: 3071
  3. -- flags: 0000
  4. -- background id: 3650
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on closeCard
  8.   put empty into card field 1
  9.   put empty into card field 2
  10. end closeCard
  11.  
  12.  
  13.  
  14. -- part 1 (button)
  15. -- low flags: 00
  16. -- high flags: A003
  17. -- rect: left=205 top=155 right=177 bottom=305
  18. -- title width / last selected line: 0
  19. -- icon id / first selected line: 0 / 0
  20. -- text alignment: 1
  21. -- font id: 0
  22. -- text size: 12
  23. -- style flags: 0
  24. -- line height: 16
  25. -- part name: Answer
  26. ----- HyperTalk script -----
  27. ----------------------------------------------------------------------
  28.  
  29. on mouseUp
  30.   --get an answer from the Data Card and put it into the card field
  31.   --
  32.   put item 2 of line random(15) of card field "Answers" of card id 3931 into card field 1
  33. end mouseUp
  34.  
  35. ----------------------------------------------------------------------
  36.  
  37. --fancier version of above - this one keeps track of the last answer
  38. --and makes sure the same one does not come up twice in a row.
  39. --**NOTE: to try out any of these alternate mouseUp routines, you
  40. --  need to remove the number (for example "2" in this case) and
  41. --  make sure you only have *one* mouseUp handler in this button.
  42.  
  43. on mouseUp2
  44.   Global whichOne
  45.   Global lastOne
  46.   put random(15) into whichOne
  47.   if lastOne is whichOne
  48.   then
  49.   repeat until lastOne is not whichOne
  50.     put random(15) into whichOne
  51.   end repeat
  52. end if
  53. put item 2 of line whichOne of card field "Answers" of card id 3931 into card field 1
  54. put whichOne into lastOne
  55. end mouseUp2
  56.  
  57. ----------------------------------------------------------------------
  58.  
  59. --an even fancier version, in case you need to choose multiple
  60. --lines and want to make sure you don't choose the same line twice
  61. --for the same card:
  62.  
  63. on mouseUp3
  64.   put random(15) into randomOne
  65.   put random(15) into randomTwo
  66.   if randomTwo is randomOne
  67.   then
  68.   repeat until randomTwo is not randomOne
  69.     put random(15) into randomTwo
  70.   end repeat
  71. end if
  72. put item 2 of line randomOne of card field "Answers" of card id 3931 into card field 1
  73. put item 2 of line randomTwo of card field "Answers" of card id 3931 into card field 2
  74. end mouseUp3
  75.  
  76. ----------------------------------------------------------------------
  77.  
  78. --and a *really* fancy version, for two lines, neither of which
  79. --are repeated from the previous card:
  80.  
  81. on mouseUp4
  82.   Global randomOne
  83.   Global randomTwo
  84.   Global oldOne
  85.   Global oldTwo
  86.   --
  87.   put random(15) into randomOne
  88.   if randomOne is oldOne or randomOne is oldTwo
  89.   then
  90.   repeat until randomOne is not oldOne and randomOne is not oldTwo
  91.     put random(15) into randomOne
  92.   end repeat
  93. end if
  94. --
  95. put random(15) into randomTwo
  96. if randomTwo is oldTwo or randomTwo is oldOne
  97. then
  98. repeat until randomTwo is not oldTwo and randomTwo is not oldOne
  99.   put random(15) into randomTwo
  100. end repeat
  101. end if
  102. --
  103. if randomTwo is randomOne
  104. then
  105. repeat until randomTwo is not randomOne and randomTwo is not oldTwo and randomTwo is not oldOne
  106.   put random(15) into randomTwo
  107. end repeat
  108. end if
  109. put item 2 of line randomOne of card field "Answers" of card id 3931 into card field 1
  110. put item 2 of line randomTwo of card field "Answers" of card id 3931 into card field 2
  111. put randomOne into oldOne
  112. put randomTwo into oldTwo
  113. end mouseUp4
  114.  
  115. ----------------------------------------------------------------------
  116.  
  117. --finally (although interesting permutations don't stop!),
  118. --here's a script for creating a random set, with no numbers
  119. --repeated.  This version makes a set of 10 numbers picked from
  120. --1 to 20.
  121.  
  122. on mouseUp5
  123.   put random(20) into randomSet
  124.   put random(20) into randomTemp
  125.   repeat while the number of items in randomSet < 10
  126.     if randomTemp is not in randomSet
  127.     then put randomTemp & "," & randomSet into randomSet
  128.   else put random(20) into randomTemp
  129. end repeat
  130. --
  131. --if you'd like the resulting set put in ascending order,
  132. --remove the two dashes from the following line:
  133. sort items of randomSet ascending numeric
  134. --
  135. put randomSet
  136. end mouseUp5
  137.  
  138. ------------------------------------------------------------------
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155. -- part 2 (field)
  156. -- low flags: 04
  157. -- high flags: 0000
  158. -- rect: left=177 top=206 right=224 bottom=462
  159. -- title width / last selected line: 0
  160. -- icon id / first selected line: 0 / 0
  161. -- text alignment: 0
  162. -- font id: 0
  163. -- text size: 12
  164. -- style flags: 0
  165. -- line height: 16
  166. -- part name: Answer
  167.  
  168.  
  169. -- part 3 (button)
  170. -- low flags: 00
  171. -- high flags: A003
  172. -- rect: left=180 top=260 right=284 bottom=338
  173. -- title width / last selected line: 0
  174. -- icon id / first selected line: 0 / 0
  175. -- text alignment: 1
  176. -- font id: 0
  177. -- text size: 12
  178. -- style flags: 0
  179. -- line height: 16
  180. -- part name: Back to Explanation
  181. ----- HyperTalk script -----
  182. on mouseUp
  183.   go to card id 4857
  184. end mouseUp
  185.  
  186.  
  187. -- part 6 (field)
  188. -- low flags: 04
  189. -- high flags: 0000
  190. -- rect: left=177 top=227 right=245 bottom=462
  191. -- title width / last selected line: 0
  192. -- icon id / first selected line: 0 / 0
  193. -- text alignment: 0
  194. -- font id: 0
  195. -- text size: 12
  196. -- style flags: 0
  197. -- line height: 16
  198. -- part name: 
  199.